package database;

/**
 * Created by IntelliJ IDEA.
 * User: grigory.rozhkov
 * Date: 12.09.12
 * Time: 23:43
 * To change this template use File | Settings | File Templates.
 */
public abstract class AbstractDBObject implements IDBObject {
    public abstract boolean create(String id, String description);

    public abstract boolean update(String description);

    public abstract String getDescription();

    public abstract String getId();

    public String convertToString() {
        return "\nINFO:\nid: " + getId() + "\ndescription: " + getDescription();
    }

    public abstract boolean isDeleted();

    public abstract void delete();

    public int compareTo(Object o) {
        if (o instanceof IDBObject){
            return this.getId().compareTo(((IDBObject)o).getId());
        }
        return 0;
    }

    public int compareTo (IDBObject anotherObject) {
        return this.getId().compareTo(anotherObject.getId());
    }

    public boolean equalsTo(IDBObject anotherObject) {
        System.out.println(anotherObject.getId());
        return this.getId().equals(anotherObject.getId());
    }
}
